<template>
  <div id="left_id">
    <el-menu
      default-active="2"
      class="el-menu-vertical-demo"
      background-color="#FF5D3E"
      text-color="#fff"
      active-text-color="#fff"
      router
    >
      <el-menu-item index="/index">
        <i class="el-icon-s-home light"></i>
        <span slot="title">首页</span>
      </el-menu-item>
      <el-submenu :index="menu.title" v-for="menu in menu_list" :key="menu.id">
        <template slot="title">
          <i :class="menu.icon" class="light"></i>
          <span>{{ menu.title }}</span>
        </template>
        <el-menu-item-group>
          <el-menu-item :index="m.url" v-for="m in menu.children" :key="m.id" class="light">
            {{ m.title }}
          </el-menu-item>
          <!-- <el-menu-item index="/role">角色管理</el-menu-item>
          <el-menu-item index="/user">管理员管理</el-menu-item> -->
        </el-menu-item-group>
      </el-submenu>
      <!-- <el-submenu index="3">
        <template slot="title">
          <i class="el-icon-goods light"></i>
          <span>商城设置</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/cate">分类管理</el-menu-item>
          <el-menu-item index="/space">规格管理</el-menu-item>
          <el-menu-item index="/goods">商品管理</el-menu-item>
        </el-menu-item-group>
      </el-submenu> -->
    </el-menu>
  </div>
</template>

<script>
import { mapMutations, mapState } from "vuex";
export default {
  created() {
    this.MenuListMutations();
  },
  methods: {
    ...mapMutations("NavStore", ["MenuListMutations"]),
  },
  computed: {
    ...mapState({ 'menu_list': state=> state.NavStore.menu_list }),
  },
};
</script>

<style>
.el-menu-vertical-demo > li {
  text-align: left;
  font-weight: 400;
}
.light {
  color: #fff !important;
}
</style>